package imageswipe.navigation.dot 
{
	import flash.display.Sprite;
	import imageswipe.vo.DotVO;
	/**
	 * ...
	 * @author 
	 */
	public class Dot extends Sprite
	{
		private var _dot:Sprite;
		private var _dataProvider:DotVO;
		
		public function Dot() 
		{
		}
		
		private function _draw():void 
		{
			if (!_dataProvider || !_dataProvider is DotVO) return;
			
			if (!_dot) _dot = new Sprite;
			_dot.graphics.clear();
			_dot.graphics.beginFill(_dataProvider.colour, _dataProvider.alpha);
			if (_dataProvider.selectedState) _dot.graphics.drawCircle(0, 0, _dataProvider.sizeSelected);
			else _dot.graphics.drawCircle(0, 0, _dataProvider.sizeUnselected);
			_dot.graphics.endFill();
			
			//trace(this, "draw:::", _dataProvider.selectedState, _dot.width);
			
			if (!this.contains(_dot)) addChild(_dot);
		}
		
		public function set dataProvider(value:DotVO):void 
		{
			if (!value) return;
			_dataProvider = value;
			_draw();
		}
		
	}

}